﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Text;

namespace Poi.NET.util
{
    /**
     * behavior of a field at a fixed location within a byte array
     *
     * @author Marc Johnson (mjohnson at apache dot org
     */

    public interface FixedField
    {

        /**
         * set the value from its offset into an array of bytes
         *
         * @param data the byte array from which the value is to be read
         *
         * @exception ArrayIndexOutOfBoundsException if the offset is out
         *            of the array's valid index range
         */

        public void readFromBytes(byte[] data);

        /**
         * set the value from an InputStream
         *
         * @param stream the InputStream from which the value is to be
         *               read
         *
         * @exception BufferUnderrunException if there is not enough data
         *            available from the InputStream
         * @exception IOException if an IOException is thrown from reading
         *            the InputStream
         */

        public void readFromStream(Stream stream);

        /**
         * write the value out to an array of bytes at the appropriate
         * offset
         *
         * @param data the array of bytes to which the value is to be
         *             written
         *
         * @exception ArrayIndexOutOfBoundsException if the offset is out
         *            of the array's valid index range
         */

        public void writeToBytes(byte[] data);

        /**
         * return the value as a String
         *
         * @return the value as a String
         */

        public String toString();
    }   // end public interface FixedField
}